package com.betterlife.todolist.activity;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.betterlife.todolist.R;
import com.betterlife.todolist.db.DBManager;
import com.betterlife.todolist.entity.Task;

public class TasksActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tasks);
		DBManager dbManager = new DBManager(this);

		Task task = new Task();
		task.setTitle("This is a test!");
		task.setContent("hello world!");

		List<Task> tasks = new ArrayList<Task>();
		tasks.add(task);
		dbManager.add(tasks);

		List<Task> results = dbManager.query();
		Task testTask = results.get(0);
		
		TextView title = (TextView)findViewById(R.id.title);
		title.setText(testTask.getTitle());
		
		TextView content = (TextView)findViewById(R.id.content);
		content.setText(testTask.getContent());
		

	}

}
